﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DotNetSources.Web.UI.Buttons.Examples.Examples._8_Repeater {

    public partial class Default : BoxContextPage {

        protected void Page_Load(object sender, EventArgs e) {

            DataItemList dil = new DataItemList();
            dil.Add(new DataItem("aaaaa", "1"));
            dil.Add(new DataItem("bbbbb", "2"));
            dil.Add(new DataItem("ccccc", "3"));
            dil.Add(new DataItem("ddddd", "4"));
            dil.Add(new DataItem("eeeee", "5"));
            dil.Add(new DataItem("fffff", "6"));

            repMain.DataSource = dil;
            repMain.DataBind();


        }

        protected void DeleteClick(Object sender, CommandEventArgs e) {
            lblResult.Text = string.Format("Command name: {0}, Command argument: {1}", e.CommandName, e.CommandArgument);
        }

    }


    public class DataItem {
        private string delId;

        public string DelId {
            get { return delId; }
            set { delId = value; }
        }
        private string value;

        public string Value {
            get { return value; }
            set { this.value = value; }
        }

        public DataItem(string value, string id) {
            this.value = value;
            this.delId = id;
        }

    }

    public class DataItemList : List<DataItem> {

    }

}

